package com.hnevc.acountms.activity;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.hnevc.acountms.R;
import com.hnevc.acountms.adapter.InaccountInfoAdapter;
import com.hnevc.acountms.dao.InaccountDao;
import com.hnevc.acountms.model.Tb_inaccount;

import java.util.List;

public class InaccountInfoActivity extends AppCompatActivity {

    RecyclerView mRecyclerView;

    private List<Tb_inaccount> inaccounts;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_inaccount_info);

        initData();


        mRecyclerView = (RecyclerView) findViewById(R.id.id_rv_info1);
        GridLayoutManager gridLayoutManager = new GridLayoutManager(this,1);
        mRecyclerView.setLayoutManager(gridLayoutManager);
        InaccountInfoAdapter adapter = new InaccountInfoAdapter(this,inaccounts);


        mRecyclerView.setAdapter(adapter);

    }

    private void initData() {
        InaccountDao inaccountDao = new InaccountDao();
        inaccounts = inaccountDao.getScrollData(0, (int) inaccountDao.getCount());

    }
}
